package me.yuxiaoyao.lock.interceptor;

import me.yuxiaoyao.lock.exception.DistributedLockException;

/**
 * @author kerryzhang on 2020/12/22
 */


public class DefaultErrorHandler implements ErrorHandler {
    @Override
    public void handleDistributedLockError(Throwable exception, Object key) {
        if (exception instanceof DistributedLockException) {
            throw (DistributedLockException) exception;
        } else {
            throw new DistributedLockException(exception.getMessage(), exception);
        }
    }
}
